package org.rsbot.script.wrappers;

import org.rsbot.client.Model;
import org.rsbot.client.RSCharacter;
import org.rsbot.script.methods.MethodContext;

class RSCharacterModel extends RSModel
{
  protected RSCharacter c;
  protected int[] x_base;
  protected int[] z_base;

  RSCharacterModel(MethodContext paramMethodContext, Model paramModel, RSCharacter paramRSCharacter)
  {
    super(paramMethodContext, paramModel);
    this.c = paramRSCharacter;
    this.x_base = this.xPoints;
    this.z_base = this.zPoints;
    this.xPoints = new int[this.xPoints.length];
    this.zPoints = new int[this.zPoints.length];
  }

  protected void update()
  {
    int i = this.c.getOrientation() & 0x3FFF;
    int j = org.rsbot.script.methods.Calculations.SIN_TABLE[i];
    int k = org.rsbot.script.methods.Calculations.COS_TABLE[i];
    for (int m = 0; m < this.x_base.length; m++)
    {
      this.xPoints[m] = (this.x_base[m] * k + this.z_base[m] * j >> 15);
      this.zPoints[m] = (this.z_base[m] * k - this.x_base[m] * j >> 15);
    }
  }

  protected int getLocalX()
  {
    return this.c.getX();
  }

  protected int getLocalY()
  {
    return this.c.getY();
  }
}